package com.molin.innerClass.lambdalianxi4;

public class CalculatorDemo {
    public static void main(String[] args) {
        int sum=useCalc(new Calculator() {
            @Override
            public int calc(int a,int b) {
                return a+b;
            }
        });
        System.out.println(sum);

//lambda
        int sum2=useCalc((int a,int b)->{return a+b;});
        System.out.println(sum2);
    }

    public static int useCalc(Calculator calculator){
        return calculator.calc(10,20);
    }
}
